package net;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.nio.charset.StandardCharsets;

/**
 * 聊天(Chat)室服务端
 */
class ClientHandler implements Runnable{
    private Socket socket;
    public ClientHandler(Socket socket) {
        this.socket = socket;
    }

    @Override
    public void run() {
        try {
            BufferedOutputStream br = new BufferedOutputStream(
                    new BufferedInputStream(socket.getInputStream())
            )
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

    }
}




public class ThreadChatServer {
    //定义服务端的ServerSocket属性
    private ServerSocket serverSocket;
    public ThreadChatServer()  {
        try {
            System.out.println("服务端开始启动");
            serverSocket = new ServerSocket(8088);
            System.out.println("服务器启动OK");
        }catch (Exception e){
            e.printStackTrace();
            System.out.println("服务器启动失败");
            System.exit(-1);
        }
    }
    //启动服务读取数据
    public void start(){
        try {
            //1.接收客户端的连接
            Socket socket = serverSocket.accept();
            System.out.println("客户端连接成功");

            }
        }catch (IOException e){
            e.printStackTrace();
        }
    }
    public static void main(String[] args) {
        new ThreadChatServer().start();
    }

}